import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import { setupRouter } from '@/router';
import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import "default-passive-events";
import zhCn from 'element-plus/es/locale/lang/zh-cn'

// 导入 VMdEditor 和主题
import VMdEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/preview.css';
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
import '@kangc/v-md-editor/lib/theme/style/github.css';
import markdownIt from 'markdown-it';

// highlightjs
import hljs from 'highlight.js';

const app = createApp(App);

VMdPreview.use(githubTheme, {
  Hljs: hljs,
});
// 使用主题并配置 markdown-it 实例
VMdEditor.use(githubTheme, {
    markdownParser: markdownIt, // 手动传入 markdown-it 实例
});
// import 'github-markdown-css'

app.use(VMdEditor);
app.use(VMdPreview);

//添加存储
const pinia = createPinia();
app.use(pinia);

//启用持久化插件
pinia.use(piniaPluginPersistedstate);

// 挂载ElementPlus
app.use(ElementPlus,{locale: zhCn});

//使用pinia
app.use(pinia);
// 创建路由
setupRouter(app);

//挂载
app.mount('#app');
